﻿@using PagedList.Mvc
@model PagedList.IPagedList<CubicFWNet.Data.ViewModal.OrderInfo>
@{
    ViewBag.Title = "提交最终价";
    var salerList = ViewBag.SalerList as IEnumerable<CubicFWNet.Data.Models.User>;
    var name = ViewBag.Name;
    var number = ViewBag.Number;
    var start = ViewBag.Start;
    var end = ViewBag.End;
}

<section class="content-header">
    <h1>
        提交最终价
    </h1>
    <ol class="breadcrumb">
        <li><a href="javascript:void(0);"><i class="fa fa-dashboard"></i>@Resources.Global.PageTitle</a></li>
        <li><a href="@Url.Action("Index","Home")">首页</a></li>
        <li class="active">提交最终价</li>
    </ol>
</section>

<section class="content">
    <div class="form-horizontal">
        <div class="box box-solid">
            <div class="box-nav clearfix">
                <div class="col-sm-12">
                    <button type="button" class="btn btn-primary" onclick="Select();" title="查询"><i class="fa fa-search"></i>&nbsp;&nbsp;查询</button>
                    <a class="btn btn-default" onclick="javascript: window.location.reload();" title="刷新"><span class="glyphicon glyphicon-refresh"></span></a>
                </div>
            </div>
            <div class="box-body">
                <table class="footable table table-stripped table-bordered table-hover" id="footable" data-page-size="20" data-filter=#filter>
                    <thead>
                        <tr>
                            @*<th data-sort-ignore="true">
                                    订单号
                                </th>*@
                            <th data-sort-ignore="true">
                                客户名称
                            </th>
                            <th data-hide="phone,tablet" data-sort-ignore="true">
                                销售员
                            </th>
                            <th data-hide="phone,tablet" data-sort-ignore="true">
                                创建时间
                            </th>
                            <th data-hide="phone,tablet" data-sort-ignore="true">
                                状态
                            </th>
                            <th data-sort-ignore="true">
                                操作
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        @if (null != Model)
                        {
                            foreach (var item in Model)
                            {
                                <tr>
                                    @*<td>
                                            @Html.DisplayFor(modelItem => item.Number)
                                        </td>*@
                                    <td>
                                        @Html.DisplayFor(modelItem => item.CustomerName)
                                    </td>
                                    <td>
                                        @Html.DisplayFor(modelItem => item.SalerName) 
                                    </td>
                                    <td>
                                        @Html.DisplayFor(modelItem => item.CreateTime)
                                    </td>
                                    <td>
                                        @Html.DisplayFor(modelItem => item.StatusName)
                                    </td>
                                    <td>
                                        @*<span class="btn bg-blue btn-xs" onclick="ShowModal('@item.Id')">查看</span>&nbsp; &nbsp;&nbsp;*@
                                        <a class="btn bg-blue btn-xs" href="ConfirmPrice?OID=@item.Id"> 提交最终价 </a>
                                    </td>
                                </tr>
                            }
                        }
                    </tbody>
                    <tfoot>
                        <tr>
                            <td colspan="7">
                                每页 @Model.PageSize 条记录，共 @Model.PageCount 页，当前第 @Model.PageNumber 页
                                @Html.PagedListPager(Model, page => Url.Action("ApplyPrice", new { page, start, end, name, number }))
                            </td>
                        </tr>
                    </tfoot>
                </table>
            </div>
        </div>
    </div>
</section>

<!--查询对话框-->
<div class="modal" id="queryDlg" style="display: none">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title">查询</h4>
            </div>
            <form class="form-horizontal" action="@Url.Action("ApplyPrice", "Order")" method="post">
                <div class="modal-body">
                    <div class="form-group">
                        <label class="col-sm-3 control-label no-padding-right" for=""> 开始时间 </label>
                        <div class="col-sm-8">
                            <input type="text" class="form-control datepicker" id="Start" name="Start" value="@ViewBag.Start" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label no-padding-right" for=""> 截至时间 </label>
                        <div class="col-sm-8">
                            <input type="text" class="form-control datepicker" id="End" name="End" value="@ViewBag.End" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label no-padding-right" for=""> 客户名称 </label>
                        <div class="col-sm-8">
                            <input type="text" class="form-control" id="Name" name="Name" value="@ViewBag.Name" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label no-padding-right" for=""> 订单号</label>
                        <div class="col-sm-8">
                            <input type="text" class="form-control" id="Number" name="Number" value="@ViewBag.Name" />
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default pull-left" data-dismiss="modal">关闭</button>
                    <button type="submit" class="btn btn-primary">查询</button>
                </div>
            </form>
        </div>
    </div>
</div>

@section Scripts {
    <script>
        $(document).ready(function () {
            $('#footable').footable();
        });

        //日期控件
        $(".datepicker").datepicker({
            autoclose: true,
            language: 'zh', //汉化
            format: "yyyy-mm-dd", //选择日期后，文本框显示的日期格式
            minView: "month",//选择日期后，不会再跳转去选择时分秒
        })

        function Select() {
            $('#queryDlg').modal();
        }

        function ShowModal(id) {
            var options = {
                id: null,
                title: '详细信息',
                width: "100%",
                height: "100%",
                url: "../Order/OrderInfo?OID=" + id,
                shade: 0.3,
                btn: ['返回'],
                btnclass: ['btn btn-danger'],
                callBack: null
            }
            $.modalOpen(options);
        }
    </script>
}